home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / disk / cdrom / CDR210kit.lha / nectools / stopaudio.c < prev   
C/C++ Source or Header  |  1995-05-11  |  2KB  |  71 lines

  1. /*
  2.     NEC-CDR-210 Stop Audio
  3.  
  4.     by dbalster@uni-paderborn.de
  5. */
  6.  
  7. #include <exec/exec.h>
  8. #include <dos/dos.h>
  9. #include <devices/scsidisk.h>
  10. #include <proto/exec.h>
  11. #include <proto/dos.h>
  12.  
  13. #include <string.h>
  14.  
  15. UBYTE    version[] = "$VER: stopaudio 0.9 for the NEC CDR-210 drive";
  16.  
  17. ULONG    sense [5];
  18. UBYTE    buffer [10];
  19. UBYTE    cmd_stop[]    = { 0xDA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
  20. UBYTE    cmd_reset[]    = { 0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
  21.  
  22. #define TEMPLATE "DEVICE/A,UNIT/N/A"
  23.  
  24. struct {
  25.     STRPTR    device;
  26.     ULONG    unit, pad1, pad2;
  27. } args;
  28.  
  29. ULONG main (VOID)
  30. {
  31.     struct MsgPort *mp;
  32.     struct SCSICmd scsi;
  33.     struct RDArgs *rdargs;
  34.     struct IOStdReq *ior;
  35.     
  36.     if (rdargs = ReadArgs(TEMPLATE,(LONG*)&args,NULL))
  37.     {
  38.         if(mp=CreateMsgPort())
  39.         {
  40.             if(ior=(struct IOStdReq*)CreateIORequest(mp,sizeof(struct IOStdReq)))
  41.             {
  42.                 if(!OpenDevice(args.device,*(ULONG*)args.unit,ior,0))
  43.                 {
  44.                     ior->io_Command    = HD_SCSICMD;
  45.                     ior->io_Data    = (APTR) &scsi;
  46.                     ior->io_Length    = sizeof(struct SCSICmd);
  47.  
  48.                     scsi.scsi_Data        = (UWORD*) buffer;
  49.                     scsi.scsi_Length    = 0;
  50.                     scsi.scsi_CmdLength    = 10;
  51.                     scsi.scsi_Flags        = SCSIF_AUTOSENSE|SCSIF_WRITE;
  52.                     scsi.scsi_SenseData    = (UBYTE*) sense;
  53.                     scsi.scsi_SenseLength    = 20;
  54.                     scsi.scsi_Command    = cmd_reset;
  55.                     DoIO(ior);
  56.                     scsi.scsi_Command    = cmd_stop;
  57.                     DoIO(ior);
  58.  
  59.                     CloseDevice((struct IORequest*)ior);
  60.                 }
  61.                 DeleteIORequest((struct IORequest*)ior);
  62.             }
  63.             DeleteMsgPort(mp);
  64.         }
  65.         FreeArgs(rdargs);
  66.     }
  67.     else PrintFault(IoErr(),0);
  68.  
  69.     return RETURN_OK;
  70. }
  71.